<?php

class Gmapsprofile_View_Helper_GmapsprofileOnline extends Zend_View_Helper_Abstract {
	public function gmapsprofileOnline($user) {
		// Get table info
		$table = Engine_Api::_ ()->getItemTable ( 'user' );
		$userTableName = $table->info ( 'name' );
		$select = $table->select ()->setIntegrityCheck ( false )->from ( $userTableName )->join ( "engine4_user_online", "engine4_user_online.user_id = `{$userTableName}`.user_id", "engine4_user_online.user_id AS online" )->where ( "{$userTableName}.user_id = ?", $user->getIdentity () );
		$rawData = $table->fetchAll ( $select );
		return count ( $rawData );
	}
}